package com.youha.service.impl;

import com.youha.dao.UserDao;
import com.youha.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author youha
 * @create 2021-08-16 13:26
 */
//<bean id="userService" class="com.youha.service.impl.UserServiceImpl">
//@Component("userService")

@Service("userService")
public class UserServiceImpl implements UserService {

//    @Value("youha")

    @Value("${jdbc.url}")
    private String name;

//    <property name="userDao" ref="userDao"></property>
//    @Autowired
//    @Qualifier("userDao")

    @Resource(name = "userDao")
    private UserDao userDao;
    @Override
    public void save() {
        System.out.println(name);
        userDao.save();
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}
